import React from 'react'
import { Form, Input, Button, DatePicker } from 'antd'
import PropTypes from 'prop-types'
const { RangePicker } = DatePicker;
function SearchBar(props) {
  const doSearch = (params) => {
    // 提交事件
    // 子向父通信  将 搜索参数传递
    props.handleSearch(params)

  }
  return (
    <Form
      onFinish={doSearch}
      layout="inline"
    >
      <Form.Item
        label="关键字"
        name="keyWord"
      >
        <Input />
      </Form.Item>
      <Form.Item
        label="编号"
        name="id"
      >
        <Input />
      </Form.Item>
      <Form.Item
      >
        <Button type="primary" htmlType="submit">
          搜索
        </Button>
      </Form.Item>
    </Form>
  )
}
SearchBar.propTypes = {
  // handleSearch 搜索事件函数
  handleSearch: PropTypes.func.isRequired
}

export default SearchBar